<?php
 
/**
 * Cestička
 */
class pStructure_Breadcrumbs extends cGadget 
{
	
	function getXHTML($view)
	{
		// oddělovat drobků
		$d = " » ";

		$path = $this->cms->tree->getPath($this->cms->view->id);

		//nastavíme name kořenovi podle nastavení webu
		$webname = $this->cms->layout->data->xpath("websetup_layout/name");
		$path[0]['name'] = (string) $webname[0];

		$last = array_pop($path);
		
		foreach ($path as $k=>$row) {
			if ($k==0) { $class='class="first_child"'; } else $class=''; 
			$s[]="<a href=\"".$view->getUrl(array("id"=>$row["id"]))."\" $class>".$row["name"]."</a>";
		}
		
		$s[]='<a href="./" class="last_child">'.$last["name"]."</a>";
		
		return implode($d, $s);
	}

}
 
?>